Reciprocal
逐元素计算输入数据的倒数。
\[output_i = \frac{1}{Input_i}\]
- 输入:
Input - 输入数据地址。
length - 计算长度。
core_mask(int, 可选) - 核掩码(仅适用于共享存储版本)。
- 输出:
output - 计算结果地址。
- 支持平台:
FT78NEMT7004
备注
FT78NE 支持 int8, int16, int32, fp32, fp64, cplx64, cplx128
MT7004 支持 fp16, fp32, int16, int32, cplx64
当输入为 0 时,输出结果为无穷大或未定义值,需由上层逻辑处理。
共享存储版本:
-
void i8_reciprocal_s(int8_t *Input, float *output, int length, int core_mask)
-
void i16_reciprocal_s(int16_t *Input, float *output, int length, int core_mask)
-
void i32_reciprocal_s(int32_t *Input, float *output, int length, int core_mask)
-
void hp_reciprocal_s(half *Input, half *output, int length, int core_mask)
-
void fp_reciprocal_s(float *Input, float *output, int length, int core_mask)
-
void dp_reciprocal_s(double *Input, double *output, int length, int core_mask)
-
void c64_reciprocal_s(float *Input, float *output, int length, int core_mask)
-
void c128_reciprocal_s(double *Input, double *output, int length, int core_mask)
C调用示例:
1//FT78NE示例 2#include <stdio.h> 3 4int main(int argc, char* argv[]) { 5 float *input = (float *)0xA0000000; //input在DDR空间 6 float *output = (float *)0xB0000000; 7 int length = 1000; 8 int core_mask = 0xff; 9 fp_reciprocal_s(input, output, length, core_mask); 10 return 0; 11}
私有存储版本:
-
void i8_reciprocal_p(int8_t *Input, float *output, int length)
-
void i16_reciprocal_p(int16_t *Input, float *output, int length)
-
void i32_reciprocal_p(int32_t *Input, float *output, int length)
-
void hp_reciprocal_p(half *Input, half *output, int length)
-
void fp_reciprocal_p(float *Input, float *output, int length)
-
void dp_reciprocal_p(double *Input, double *output, int length)
-
void c64_reciprocal_p(float *Input, float *output, int length)
-
void c128_reciprocal_p(double *Input, double *output, int length)
C调用示例:
1//MT7004示例 2#include <stdio.h> 3 4int main(int argc, char* argv[]) { 5 float *input = (float *)0x10000000; 6 float *output = (float *)0x10001000; 7 int length = 1000; 8 fp_reciprocal_p(input, output, length); 9 return 0; 10}